package cn.wit.front.service.impl;

import cn.wit.front.condition.SearchSkillsCondition;
import cn.wit.front.mapper.SkillsMapper;
import cn.wit.front.service.SkillsService;
import cn.wit.utils.pojo.Skills;
import cn.wit.utils.response.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SkillsServiceImpl implements SkillsService {
    @Autowired
    private SkillsMapper skillsMapper;


    @Override
    public Result searchPage(IPage<Skills> page, SearchSkillsCondition condition) {
        QueryWrapper<Skills> wrapper = new QueryWrapper<>();
        if(condition != null) {
            if(condition.getSkillName() != null && condition.getSkillName() != "") {
                wrapper.like("skill_name", condition.getSkillName());
            }
        }
        IPage<Skills> skillsIPage = skillsMapper.selectPage(page, wrapper);
        return Result.ok(skillsIPage);
    }
}
